package com.eascs.admin.o2o.loanAccount.dao;

import org.springframework.stereotype.Repository;

import com.eascs.admin.common.dao.BaseO2oDao;
import com.eascs.admin.o2o.loanAccount.entity.AccountLogForm;
import com.eascs.app.dao.PageResult;
import com.eascs.app.dao.SqlPageQuery;
import com.eascs.common.util.StringUtil;

/**
* @author bao.pan 2017年11月28日 下午6:04:23
*/
@Repository
public class AccountLogDao extends BaseO2oDao {

	public PageResult<Object[]> findAccountLogByPage(AccountLogForm accountLogForm) {
		SqlPageQuery<Object[]> pageQuery = new SqlPageQuery<Object[]>(Object[].class, accountLogForm.getPageSize(), accountLogForm.getPageIndex());
		String querySql = "sql.o2o.accountLog.querybypage";
		StringBuffer sql = new StringBuffer(this.getSql(querySql));
		if (StringUtil.hasText(accountLogForm.getLogType())) {
			sql.append(" AND log_type = ?");
			pageQuery.addParam(accountLogForm.getLogType());
		}

		sql.append(" ORDER BY start_time desc ");
		pageQuery.setQuerySql(sql.toString());
		return this.findDataWithPage(pageQuery);
	}
}
